package com.methods;

/**
 * 出租车类
 * 2017/8/16
 * @author Erik
 * @version 0.1
 * @since JDK1.8.
 */
public class Taxi extends Car {
    private String company;

    public Taxi(){}
    public Taxi(String color,String userName,String company){
        //TODO 初始化
        super(color,userName);
        this.setCompany(company);
    }

    //setters
    public void setCompany(String company) {    this.company = company; }

    //getters
    public String getCompany() {    return this.company;    }

    public void use(){
        System.out.println("出租车是提高市民生活质量的重要条件之一");
    }

    public final void ride(){
        System.out.println(this.getUserName()+"的出租车隶属于"+this.getCompany());
    }

    public String toString(){
        String str=this.getUserName()+"拥有一辆"+this.getColor()+"的出租车";
        return str;
    }
}
